package com.idealighter.game.roomcard.struct;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.idealighter.game.server.db.datadb.generate.domain.RoomCardRoomListDomain;
import com.idealighter.utils.check.EmptyUtil;

public class RoomCardRoomCfg<C extends RoomCardRoomCfgValue> extends RoomCardRoomListDomain {
  private static final long serialVersionUID = 4376541679131205897L;
  private TypeReference<C> cfgValueType;

  public RoomCardRoomCfg(TypeReference<C> typeRefer) {
    cfgValueType = typeRefer;
  }

  /**
   * @Title cfgs.
   * @Description 获取配置信息
   * @date 2018年6月14日 下午4:32:29
   * @return .
   */
  public C cfgs() {
    C result = null;
    if (EmptyUtil.stringIsNotEmpty(this.getGameCfg())) {
      result = JSON.parseObject(this.getGameCfg(), cfgValueType);
    }
    return result;
  }
}
